package org.gdpu.Service.Impl;

import org.gdpu.Service.DormitoryService;
import org.gdpu.Service.UserService;
import org.gdpu.base.DaoSupport;
import org.gdpu.model.Dormitory;
import org.gdpu.model.User;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by HEWI2 on 2/17/14.
 */

@Service
@Transactional
public class UserServiceImpl extends DaoSupport<User> implements UserService {



    @Override
    public User findByName(String name) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("userName", name);
        return (User) this.findSpecialObject(User.class, params);
    }

    @Override
    public User findByDormitory(Dormitory dormitory) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("dormitory", dormitory);
        return (User) this.findSpecialObject(User.class, params);
    }
}
